package com.cn.main.framework;

import com.cn.main.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Import;

/**
 * user : chenyuncong
 * create_time : 2022/9/3
 */
@Import({RunFactoryBeanDefinitionRegistry.class})
public class Demo {
    @Test
    public void run() {
        ApplicationContext applicationContext=new AnnotationConfigApplicationContext(Demo.class);
        UserService bird= applicationContext.getBean(UserService.class);
        System.out.println(applicationContext.containsBean("UserService"));
        UserService bird2 = applicationContext.getBean("UserService",UserService.class);
        System.out.println(bird);
        bird.run("你好");
    }

    interface Bird {
        void run();
    }
}
